package com.xuanyuanzi.all_learning.infrastructure.common.enums;

import java.util.ArrayList;
import java.util.List;

public enum ClientTypeEnum {


    IPC("PC", "前端用户"),

    IMOBILE("MOBILE", "手机端用户"),

    OA("OA", "OA端用户"),

    SYNC("SYNC", "同步接口"),
    ;

    private String value;
    private String name;

    private ClientTypeEnum(String value, String name) {
        this.value = value;
        this.name = name;
    }

    public String getValue() {
        return value;
    }


    public String getName() {
        return name;
    }


    public static ClientTypeEnum fromValue(String v) {
        for (ClientTypeEnum c : ClientTypeEnum.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }
        throw new IllegalArgumentException(v + "");
    }

    public static ClientTypeEnum fromName(String name) {
        for (ClientTypeEnum c : ClientTypeEnum.values()) {
            if (c.name.equals(name)) {
                return c;
            }
        }
        throw new IllegalArgumentException(name + "");
    }


    public static List<String> getValueList() {
        List<String> valueList = new ArrayList<>();
        for (ClientTypeEnum c : ClientTypeEnum.values()) {
            valueList.add(c.getValue());
        }
        return valueList;
    }

    public static List<String> getNameList() {
        List<String> nameList = new ArrayList<>();
        for (ClientTypeEnum c : ClientTypeEnum.values()) {
            nameList.add(c.getName());
        }
        return nameList;
    }
}
